package design.pattern.singleton.demo2;

/**
 * 饿汉式：静态代码块
 * @author AtoVio, Winter Yuan
 */
public class Singleton {

    // 私有构造方法
    private Singleton(){}

    private static final Singleton instance;

    // 静态代码块中赋值
    static {
        instance = new Singleton();
    }

    public static Singleton getInstance() {
        return instance;
    }
}
